package rickyGame.game
{
	import flash.utils.setTimeout;
	
	import ricky.animate.AnimSprite;
	import ricky.utils.TimeServer;
	import ricky.game.Actor2D;
	import ricky.game.action.Act2D;
	
	import rickyGame.game.skill.SkillData;
	
	/**
	 * 技能特效对象
	 * 特点没有动作的时候自身会销毁
	 */
	public class SkillObject extends Actor2D
	{
		public function SkillObject(actor:Fighter,skillData:SkillData)
		{
			super();
			this._actor=actor;
			this._skillData=skillData;
		}
//		
		/**
		 * 行动结束
		 */ 
		override protected function actComplete(e:Act2D):void
		{

			if(e.next)
			{
				this.addAct(e.next);
			}else
			{
				e.end();
				e.dispose();
				e=null;
				this.dispose();
			}
		
		}

		//
		private var _actor:Fighter
		private var _skillData:SkillData;

		public function get actor():Fighter
		{
			return _actor;
		}

		public function set actor(value:Fighter):void
		{
			_actor = value;
		}

		public function get skillData():SkillData
		{
			return _skillData;
		}

		public function set skillData(value:SkillData):void
		{
			_skillData = value;
		}

		override public function  dispose():void
		{
			GameState.inst.sceneManager.removeGameObject(this);
//			super.dispose();
		}
		
		override public function wear(mode:String=null,name:String=null,onLoaded:Function=null):void
		{
			if(mode)
				graphic.wear(mode);
			else
				graphic.wear(this.skillData.model);
		}
		//
//		private var _beginTime:Number;
	}
}